package init

import (
	"fmt"
	"github.com/elastic/go-elasticsearch/v7"
	"house-src/basic/config"
	"log"
)

func EsInit() {
	var err error
	cfg := elasticsearch.Config{
		Addresses: []string{
			"http://" + fmt.Sprintf("%s:%d", config.AppConf.Es.Host, config.AppConf.Es.Port),
		},
		// ...
	}
	config.Els, err = elasticsearch.NewClient(cfg)
	if err != nil {
		panic(err)
		return
	}
	log.Println("ES init success")
}
